unit Unit2;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, Buttons, PngBitBtn, ZConnection, DB,
  ZAbstractRODataset, ZAbstractDataset, ZDataset;

type
  TForm2 = class(TForm)
    Panel1: TPanel;
    RadioButton1: TRadioButton;
    RadioButton2: TRadioButton;
    GroupBox1: TGroupBox;
    PngBitBtn1: TPngBitBtn;
    PngBitBtn2: TPngBitBtn;
    GroupBox2: TGroupBox;
    Edit1: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    edt1: TEdit;
    edt2: TEdit;
    edt3: TEdit;
    lbl1: TLabel;
    lbl2: TLabel;
    lbl3: TLabel;
    pnl1: TPanel;
    edt4: TEdit;
    edt5: TEdit;
    edt6: TEdit;
    edt7: TEdit;
    edt8: TEdit;
    btn1: TSpeedButton;
    lbl4: TLabel;
    lbl5: TLabel;
    lbl6: TLabel;
    lbl7: TLabel;
    con1: TZConnection;
    zqry1: TZQuery;
    procedure btn1Click(Sender: TObject);
    procedure PngBitBtn2Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure PngBitBtn1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

uses Unit3;

{$R *.dfm}

procedure TForm2.btn1Click(Sender: TObject);
begin
form3.showmodal;
end;

procedure TForm2.PngBitBtn2Click(Sender: TObject);
begin
form2.Close;
end;

procedure TForm2.FormCreate(Sender: TObject);
begin
con1.Connected:=true;
zqry1.active:=false;
zqry1.SQL.Clear;
zqry1.SQL.Add('select * from kartka');
zqry1.Active:=true;
if zqry1.Fields.FieldByName('phys').value='1' then RadioButton2.Checked:=true;
edt4.Text:=Utf8ToAnsi(zqry1.Fields.fieldbyname('edrpou').Value);
edt5.Text:=Utf8ToAnsi(zqry1.Fields.fieldbyname('name').Value);
edt6.Text:=Utf8ToAnsi(zqry1.Fields.fieldbyname('full').Value);
edt7.Text:=Utf8ToAnsi(zqry1.Fields.fieldbyname('insp').Value);
edt8.Text:=Utf8ToAnsi(zqry1.Fields.fieldbyname('name_insp').Value);
edit1.Text:=Utf8ToAnsi(zqry1.Fields.fieldbyname('ker_inn').Value);
edit2.Text:=Utf8ToAnsi(zqry1.Fields.fieldbyname('ker_name').Value);
edit3.Text:=Utf8ToAnsi(zqry1.Fields.fieldbyname('ker_tel').Value);
edt1.Text:=Utf8ToAnsi(zqry1.Fields.fieldbyname('buh_inn').Value);
edt2.Text:=Utf8ToAnsi(zqry1.Fields.fieldbyname('buh_name').Value);
edt3.Text:=Utf8ToAnsi(zqry1.Fields.fieldbyname('buh_tel').Value);
end;

procedure TForm2.PngBitBtn1Click(Sender: TObject);
var
  j:string;
begin
  if RadioButton2.Checked=true then j:='1' else j:='0';
zqry1.active:=false;
zqry1.SQL.Clear;
zqry1.SQL.Add('update kartka set phys='+quotedstr(j)+',edrpou='+quotedstr(ansitoutf8(edt4.text))+',name='+quotedstr(ansitoutf8(edt5.text))+',full='+quotedstr(ansitoutf8(edt6.text))+',insp='+quotedstr(ansitoutf8(edt7.text))+',name_insp='+quotedstr(ansitoutf8(edt8.text))+',ker_inn='+quotedstr(ansitoutf8(Edit1.text))+',ker_name='+quotedstr(ansitoutf8(edit2.text))+',ker_tel='+quotedstr(ansitoutf8(Edit3.text))+',buh_inn='+quotedstr(ansitoutf8(edt1.text))+',buh_name='+quotedstr(ansitoutf8(edt2.text))+',buh_tel='+quotedstr(ansitoutf8(edt3.text)));
zqry1.Active:=true;
form2.Close;
end;

end.
 